package com.zhome.gateway.constants;

/**
 *
 * @author cuiyh9
 * @date 2020/5/9
 */
public interface Constants {

    String PRE_KEY = "pre";

    String ROUTE_KEY = "route";

    String POST_KEY = "post";


    int NOT_DEL_FLAG = 1;

    String APPLICATION_FORM = "application/x-www-form-urlencoded";

    String APPLICATION_JSON = "application/json";



    /**
     * RequestContext的key
     */
    interface RequestContextKey {

        // 路由信息
        String CTX_X_ROUTEINFO = "ctx_x_routeinfo";

        // 是否mock
        String CTX_X_IS_MOCK = "ctx_x_is_mock";

        // http 请求体
        String CTX_X_REQUEST_BODY = "ctx_x_request_body";

        // 要请求转发到的URL
        String CTX_X_FULL_URL = "ctx_x_full_url";

        // 后续的Filter(除post类型的Filter)是否可以执行
        String CTX_X_SUCCESSOR_CAN_EXECUTE = "ctx_x_successor_can_execute";

        // 每次请求上下文的唯一标识
        String CTX_X_REQUEST_ID = "ctx_x_request_id";

        // 请求服务名
        String CTX_X_SERVER_NAME = "ctx_x_server_name";

        // 请求信息 - 开始时间,时间戳，毫秒
        String CTX_X_REQ_START_TIME = "ctx_x_start_time";

        // 请求信息 - 耗费时间,时间戳，毫秒
        String CTX_X_REQ_CONSUME_TIME = "ctx_x_consume_time";
    }

    /**
     * Http请求头的Key
     */
    interface RequestHeader {

        String CONTENT_TYPE = "Content-Type";

        String TOKEN = "Token";

        String USER_AGENT = "user-agent";


        String APP_ID = "AppId";

        String ACCESS_ID = "AccessId";


        String X_TIMESTAMP = "X-timeStamp";

        String X_OSTYPE = "X-osType";

        String X_SYS = "X-Sys";

        String X_IMEI = "X-imei";

        String X_CLIENT_VERSION = "X-Client-Version";

        String X_OS_VERSION = "X-os-version";

        String X_PHONENAME = "X-phoneName";

        String X_REQUEST_ID = "X-Request-Id";


    }
    interface  HttpConst {
        /**
         * 几种常见的Content-Type
         */
        String FORM_URLENCODED_CONTENT_TYPE = "application/x-www-form-urlencoded";

        String JSON_CONTENT_TYPE = "application/json";

        String MULTIPART_CONTENT_TYPE = "multipart/form-data";

        /**
         * 常见的post/get请求方式
         */
        String POST_METHOD = "post";

        String GET_METHOD = "get";

    }

    interface ServerType {
        String HTTP = "HTTP";

        String DUBBO = "Dubbo";

        String NACOS = "Nacos";

    }


}
